=generate-utility($utility)
  $values: map-get($utility, values)

  // If the values are a list or string, convert it into a map
  @if type-of($values) == "string" or type-of(nth($values, 1)) != "list"
    $values: zip($values, $values)

  @each $value in $values
    $properties: map-get($utility, property)

    // Multiple properties are possible, for example with vertical or horizontal margins or paddings
    @if type-of($properties) == 'string'
      $properties: append((), $properties)

    // Property can be a map, where the key is a mixin to include
    @if type-of($properties) == 'map'
      @each $dir in $properties
        $mixin: nth($dir, 1)
        // SASS doesn't support dynamic mixin invocation
        // https://github.com/sass/sass/issues/626
    @else
    #{$container-name}
      +generate-utility-body($utility, $properties, $value)

=generate-utility-body($utility, $properties, $value)
  // Use custom class if present
  $property-class: map-get($utility, class)
  $property-class: if($property-class, $property-class, nth($properties, 1))

  // Don't prefix if value key is null (eg. with shadow class)
  $property-class-modifier: if(nth($value, 1), "-" + nth($value, 1), "")

  $value: nth($value, 2)

  .#{$property-class + $property-class-modifier}
    @for $i from 1 through length($properties)
      $property: nth($properties, $i)
      $val: if((type-of($value) == 'list' and length($properties) == length($value)),nth($value, $i), $value ) 
      #{$property}: $val !important
